#!/bin/sh
# This regression test is a part of SIPp.
# A fatal error is on stderr once. It used to be printed when it
# happened, and again by the exit, as the last error.
. "`dirname "$0"`/../functions"; init

err=`mktemp`
trap 'rm -f "$err"' EXIT

# Nothing listens there: the connection is refused.
sippfg -sn uac -t t1 -i 127.0.0.1 -p 23160 127.0.0.1:23161 -m 1 \
    -timeout 5 >/dev/null 2>"$err"
status=$?
test $status -eq 255 || fail "exit code $status"
n=`grep -c 'Error on TCP connection' "$err"`
test "$n" -eq 1 || fail "the error is on stderr $n times"
ok
